home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-16 / mrim0291.zip / MICRORIM.053 < prev    next >
Text File  |  1991-02-06  |  75KB  |  2,047 lines

  1.  
  2.  
  3.  
  4.    Volume 6, Number 2                                       February 1991
  5.    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6.    ::                  ***************                                 ::
  7.    ::               *********************                              ::
  8.    ::            ***************************                           ::
  9.    ::          ******************************                          ::
  10.    ::        ****************    ************                          ::
  11.    ::      ***************       *************                         ::
  12.    ::     ***************       **************                         ::
  13.    ::    ***************      ***************                          ::
  14.    ::   ****************   *****************                           ::
  15.    ::  *****************   *************                               ::
  16.    ::  *****************   **************          Microrim ONLINE     ::
  17.    :: ******************   ***************         """""""""""""""     ::
  18.    :: ******************   ****************     Online Technical Tips  ::
  19.    :: ******************   *****************                           ::
  20.    :: ******************   ******************                          ::
  21.    :: ******************   *******************                         ::
  22.    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23.    Technical tips, techniques, and macros from Microrim, Inc.
  24.  
  25.    Microrim ONLINE is published electronically approximately every month
  26.    by Microrim, Inc. and distributed exclusively on the Microrim Bulletin
  27.    Board System (BBS). You can obtain your copy free of charge by
  28.    downloading it. Call 206-649-9836 and use this setup:  8 data bits, 1
  29.    stop bit, No parity, and 1200 or 2400 baud. It operates 24 hours a
  30.    day, seven days a week.
  31.  
  32.    COPYRIGHT
  33.    """""""""
  34.    Copyright 1991 by Microrim, Inc. All rights reserved. Microrim, Inc.
  35.    authorizes the free distribution of this document for educational
  36.    purposes as long as no charge is made and this document is distributed
  37.    exactly as is, in its entirety, without modification or revision of
  38.    any kind. Toward this end, this document may be stored in, uploaded
  39.    to, and downloaded from any Bulletin Board Service (BBS) or electronic
  40.    information service as long as no charge is made and it is kept
  41.    intact.
  42.  
  43.    CONTRIBUTIONS
  44.    """""""""""""
  45.    You are encouraged to contribute to Microrim ONLINE and to R:BASE
  46.    EXCHANGE.  Please upload your article, application, or application
  47.    story to the Microrim BBS or send an IBM compatible disk in standard
  48.    ASCII format to:
  49.  
  50.    Kay D. Dayss, Editor
  51.    Microrim ONLINE and R:BASE EXCHANGE
  52.    Microrim, Inc.
  53.    15395 S.E. 30th Place
  54.    Bellevue, WA  98007
  55.  
  56.    By submitting an article, you agree that the material is not
  57.    confidential and that Microrim, Inc., may use, duplicate, modify,
  58.    publish, or sell it without obligation or liability to you or anyone
  59.  
  60.  
  61.  
  62.    MICRORIM ONLINE February 1991 -------------------------- Page 1 of 31
  63.  
  64.  
  65.  
  66.  
  67.  
  68.    else. Articles appearing in Microrim ONLINE are later published in
  69.    R:BASE EXCHANGE. When your article is published in R:BASE EXCHANGE you
  70.    may choose one of these:  R:BASE 3.1, DB Graphics, Extended Report
  71.    Writer (XRW), Clout, R:MACROS, R:TOOLS, or R:PARTNER.
  72.  
  73.    TRADEMARKS
  74.    """"""""""
  75.    R:BASE and Microrim are registered trademarks of Microrim, Inc. IBM is
  76.    a registered trademark of International Business Machines Corporation.
  77.    dBASE, dBASE III, dBASE III Plus, dBASE IV, and Ashton-Tate are
  78.    registered trademarks of Ashton-Tate.
  79.  
  80.    DISCLAIMER
  81.    """"""""""
  82.    Microrim, Inc., makes no representation or warranties with respect to
  83.    the contents hereof, and specifically disclaims any implied warranties
  84.    of merchantability or fitness for any particular purpose. Further,
  85.    Microrim, Inc., reserves the right to revise this publication and to
  86.    make changes in the content hereof without obligation to notify any
  87.    person of such revision or change and shall not be liable for errors
  88.    contained herein or for incidental or consequential damages in
  89.    connection with the furnishing, performance, or use of this material.
  90.    All opinions and product reviews in MICRORIM ONLINE are those of the
  91.    author and not necessarily those of Microrim, Inc.
  92.  
  93.    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  94.    ::                       TABLE OF CONTENTS                          ::
  95.    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  96.  
  97.    Microrim Ships R:BASE 3.1 Runtime .................................. 3
  98.    Checklist of R:BASE Tools That Help Ensure Accurate Data ........... 4
  99.    Protect Your Database with R:BASE Rules ............................ 6
  100.    Convert Dollars to Words in a Form While Entering Checks .......... 13
  101.    Build dBASE Index & Data Files in R:BASE 3.1 ...................... 17
  102.    February 1991 Problems & Workarounds .............................. 22
  103.  
  104.    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.    MICRORIM ONLINE February 1991 -------------------------- Page 2 of 31
  129.  
  130.  
  131.  
  132.  
  133.  
  134.    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  135.    ::                            ARTICLES                              ::
  136.    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  137.  
  138.    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  139.    MICRORIM SHIPS R:BASE 3.1 RUNTIME
  140.    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  141.    PRODUCT   :  R:BASE                  VERSION      :  3.1
  142.    CATEGORY  :  DISTRIBUTION            SUBCATEGORY  :  RUNTIME
  143.    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  144.  
  145.    Now you can use R:BASE 3.1 Runtime to distribute executable R:BASE 3.1
  146.    applications easily and economically. By distributing your application
  147.    with a copy of R:BASE 3.1 Runtime, your users will be able to run your
  148.    application without purchasing R:BASE. Order yours today!
  149.  
  150.  
  151.    Runtime Features & Versions
  152.    """""""""""""""""""""""""""
  153.    Runtime is fully compatible with Application EXPRESS and custom
  154.    applications. It supports both single- and multi-user (local area
  155.    network) applications. It supports all R:BASE 3.1 commands EXCEPT
  156.    creation commands like these:
  157.  
  158.    CODELOCK                CREATE VIEW               FORMS
  159.    LIST                    PROMPT                    RBEDIT
  160.    RESTORE                 SHOW                      BACKUP ALL
  161.    BACKUP STRUCTURE        CREATE SCHEMA             CREATE TABLE
  162.    DEFINE                  EXPRESS                   GATEWAY
  163.    HELP                    LIST ACCESS               MENU
  164.    QUERY                   RBDEFINE                  RBLABELS
  165.    REPORTS                 RULES                     SET (alone)
  166.    UNLOAD ALL              UNLOAD STRUCTURE
  167.  
  168.  
  169.    Unlimited or Five-copy Runtime
  170.    """"""""""""""""""""""""""""""
  171.    You have two choices with R:BASE 3.1. You can get a Five copy version
  172.    of R:BASE 3.1 Runtime for only $150--$30 for each copy--or an
  173.    Unlimited copy version of R:BASE 3.1 Runtime for only $595. With
  174.    Unlimited R:BASE 3.1 Runtime, you can distribute an unlimited number
  175.    of copies.
  176.  
  177.    Order R:BASE 3.1 Runtime (Five copy or Unlimited) from Microrim by
  178.    calling 1-800-248-2001.
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.    MICRORIM ONLINE February 1991 -------------------------- Page 3 of 31
  195.  
  196.  
  197.  
  198.  
  199.  
  200.    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  201.    CHECKLIST OF R:BASE TOOLS THAT HELP ENSURE ACCURATE DATA
  202.    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  203.    PRODUCT   :  R:BASE                  VERSION      :  3.1
  204.    CATEGORY  :  RULES                   SUBCATEGORY  :  TOOLS
  205.    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  206.  
  207.    Every database application needs to protect against inaccurate data
  208.    and human error. Here's a checklist to help you ensure accuracy.
  209.  
  210.    []  R:BASE rules--Check data before adding it to the database. Read
  211.        "Protect Your Database with R:BASE Rules" to learn more.
  212.  
  213.    []  Multi-table R:BASE forms--Pass common values to lower tables in
  214.        the form automatically. Users never have to enter the same value
  215.        twice. When you enter a customer identification number in the
  216.        first table in a data entry form, R:BASE automatically passes it
  217.        to the other (lower) tables in the form if those lower tables also
  218.        contain that column--even if the common column isn't located on
  219.        the form for the lower tables. In this way, R:BASE forms
  220.        automatically maintain relational links between tables.
  221.  
  222.    []  Entry/Exit procedures (EEPs) in forms--Check complex conditions or
  223.        do complex conversions without leaving the form. For an example,
  224.        see "Convert Dollars to Words in a Form While Entering Checks."
  225.        The more work you can get the computer to do automatically, the
  226.        less chance for data entry errors. Personal R:BASE users can't
  227.        create EEPs but they can run applications created in R:BASE 3.1
  228.        that contain EEPs.
  229.  
  230.    []  Expressions and SuperMath functions--Filter data to make it
  231.        consistent by adding lookups, expressions, and SuperMath functions
  232.        to a form. For example, use the following expression to ensure
  233.        that all last names begin with a capital letter and are otherwise
  234.        in lowercase: lastname=(ICAP1(lastname)).
  235.  
  236.    []  Computed values--Choose among using an EEP, a form expression, or
  237.        a computed column to have R:BASE compute values or otherwise
  238.        massage data. You'll need to decide which solution best fits your
  239.        specific needs.
  240.  
  241.    []  Playback files--Create playback (script) files to run processes
  242.        automatically. In R:BASE 3.1, you can write R:BASE programs that
  243.        create and run playback files. EEPs can use this feature to return
  244.        a value to the form. For an example, see NUM2WORD.EEP in "Convert
  245.        Dollars to Words in a Form While Entering Checks." Personal R:BASE
  246.        users can't create playback files, but they can use an application
  247.        developed for them by an R:BASE 3.1 user that includes an EEP that
  248.        creates and runs a playback file.
  249.  
  250.    []  Pop-up menus in forms--Save keystrokes and help keep data
  251.        consistent by using pop-up menus.
  252.  
  253.    []  Default values--Save keystrokes by using default values for form
  254.        fields, FILLIN commands, and SWITCH...ENDSW blocks.
  255.  
  256.  
  257.  
  258.  
  259.  
  260.    MICRORIM ONLINE February 1991 -------------------------- Page 4 of 31
  261.  
  262.  
  263.  
  264.  
  265.  
  266.    []  Help lines--Implement help lines to tell users what to enter.
  267.        Informed users are more likely to enter exactly what you want.
  268.  
  269.    []  Tolerance Setting--Set tolerance to allow approximations for REAL
  270.        and DOUBLE numbers when it's appropriate. For example, use a
  271.        tolerance setting of .1 to allow this clause: WHERE realcol=5 to
  272.        mean: WHERE realcol BETWEEN 4.9 AND 5.1.
  273.  
  274.    []  Programming--Write programs, set variable data types, and use
  275.        error variables to check for error conditions. This can prevent
  276.        users from entering invalid data or pressing invalid keys when
  277.        they respond to a FILLIN or dialog box or when they choose an item
  278.        from a menu. R:BASE programming is available in R:BASE 3.1, but it
  279.        isn't available in Personal R:BASE.
  280.  
  281.    []  Database Integrity checks--Check your database before you back it
  282.        up. Use RBCHECK (the program that came with R:BASE), or better
  283.        yet, get Microrim's exciting new product, R:SCOPE, to check and
  284.        fix your databases.
  285.  
  286.    []  Backups--Keep two generations of backups (yesterday's database and
  287.        the day before yesterday's database) to guard against backing up a
  288.        troubled database on top of a good database. Always back up what
  289.        you do not want to reproduce.
  290.  
  291.    R:BASE gives you a wide selection of tools to help ensure accurate
  292.    data.
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.    MICRORIM ONLINE February 1991 -------------------------- Page 5 of 31
  327.  
  328.  
  329.  
  330.  
  331.  
  332.    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  333.    PROTECT YOUR DATABASE WITH R:BASE RULES
  334.    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  335.    PRODUCT   :  R:BASE                  VERSION      :  3.1
  336.    CATEGORY  :  RULES                   SUBCATEGORY  :  PERFORMANCE
  337.    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  338.  
  339.    By using R:BASE rules, you can dramatically improve the quality of
  340.    your data by protecting your database from inaccurate entries. Use the
  341.    menus to create R:BASE rules in Personal R:BASE. Use the menus, RULES
  342.    command, RBDEFINE command, or CREATE TABLE command to create R:BASE
  343.    rules in R:BASE 3.1.
  344.  
  345.  
  346.    Introducing R:BASE Rules
  347.    """"""""""""""""""""""""
  348.    Get an introduction to R:BASE rules from the R:BASE 3.1 "User's
  349.    Manual" and "Reference Manual" or from the Personal R:BASE "User's
  350.    Guide" (see Appendix D for information on WHERE clauses).
  351.  
  352.  
  353.    Related Options Under Tools
  354.    """""""""""""""""""""""""""
  355.    The following options under Tools on the Main Menu are related to
  356.    rules:
  357.  
  358.      o  "Back up database..." will back up the entire database, including
  359.         rules.
  360.      o  "Maintenance" has a "List rules" option.
  361.      o  "Maintenance" has a "Selective backup" option that allows  you to
  362.         back up the structure only, including rules. This option is
  363.         available in R:BASE 3.1 only, not in Personal R:BASE.
  364.      o  "Settings" has a "Rules" option under Settings that allows you to
  365.         turn rule checking on and off.
  366.  
  367.  
  368.    Setting Rule Checking ON & OFF
  369.    """"""""""""""""""""""""""""""
  370.    To set RULES ON, use the SET RULES ON command or choose "Settings"
  371.    under Tools and then "Rules..." under Settings. RULES are usually ON
  372.    because that's the default. With RULES ON, R:BASE checks rules in each
  373.    of these situations:
  374.  
  375.      o  Using a form to enter or edit data.
  376.      o  Inserting a row or editing data while using the Info/Views menu.
  377.      o  Using any of these commands: EDIT, INSERT, LOAD, ENTER, UPDATE,
  378.         or the undocumented APPEND or CHANGE commands.
  379.  
  380.    With RULES ON, R:BASE checks all rules assigned to a table, not just
  381.    the ones on the columns that are currently displayed or that happen to
  382.    be located on a form. When a rule breaks, if the column isn't
  383.    displayed or located, there's no way you can correct it. Consider this
  384.    when you design rules and forms.
  385.  
  386.    Set RULES OFF when you don't need to check rules. This speeds up
  387.    processing because R:BASE doesn't have to check the SYSRULES table
  388.    when it's not necessary to do so.
  389.  
  390.  
  391.  
  392.    MICRORIM ONLINE February 1991 -------------------------- Page 6 of 31
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.    Four Parts to a Rule
  400.    """"""""""""""""""""
  401.    Most people create rules either by using the RULES command or by using
  402.    the menus. Either way, each time you create a rule you'll need to
  403.    provide these four parts:
  404.  
  405.      o  SUCCEEDS or FAILS.
  406.      o  Table that's protected by the rule.
  407.      o  Rule's error message.
  408.      o  Rule's WHERE clause.
  409.  
  410.    All R:BASE rules are stored in the SYSRULES system table in four
  411.    columns:
  412.  
  413.      o  SYSTABLE (TEXT 18) holds the name of the protected table.
  414.      o  SYSMSG (NOTE) holds the error message defined by the rule.
  415.      o  SYSEF (INTEGER) is equal to 1 if the rule uses SUCCEEDS, 0 if it
  416.         uses FAILS.
  417.      o  SYSWHERE (NOTE) holds the rule's WHERE clause.
  418.  
  419.  
  420.    SUCCEEDS or FAILS
  421.    """""""""""""""""
  422.    SUCCEEDS or FAILS tells R:BASE when you want the rule to break. If you
  423.    choose SUCCEEDS, the WHERE clause conditions must be met. If they
  424.    aren't, R:BASE will display your error message and not allow the
  425.    value. If you choose FAILS, the WHERE clause conditions must not be
  426.    met. If they are, R:BASE will display the error message and not allow
  427.    the value.
  428.  
  429.    SUCCEEDS means the WHERE clause describes acceptable values. FAILS
  430.    means the WHERE clause describes unacceptable values. Most people
  431.    consistently use SUCCEEDS.
  432.  
  433.  
  434.    Rule-protected Table
  435.    """"""""""""""""""""
  436.    Every rule applies to values that are going into one table. The rule
  437.    determines whether a value gets into that table. If the same rule
  438.    applies to several tables, define it for each table.
  439.  
  440.  
  441.    Error Message
  442.    """""""""""""
  443.    When a rule breaks, R:BASE displays the error message and rejects the
  444.    data that broke the rule.
  445.  
  446.    Create descriptive error messages 50 or fewer characters in length.
  447.    Try to make the message active and positive like this: "-ERROR- Enter
  448.    Y for yes or N for no." Messages can be negative like this: "-ERROR-
  449.    Last name cannot be null." But positive messages are often easier to
  450.    understand. Here's a positive version: "-ERROR- You must enter a last
  451.    name." Include the field name in the error message, so the user can
  452.    quickly find the field that broke the rule.
  453.  
  454.  
  455.  
  456.  
  457.  
  458.    MICRORIM ONLINE February 1991 -------------------------- Page 7 of 31
  459.  
  460.  
  461.  
  462.  
  463.  
  464.    Build the WHERE Clause
  465.    """"""""""""""""""""""
  466.    You can use a full WHERE clause, including sub-SELECTs and
  467.    parentheses.
  468.  
  469.  
  470.    Example Rules
  471.    """""""""""""
  472.    Here are efficient rule definitions for several common situations. All
  473.    use the CONCOMP database.
  474.  
  475.         RULES 'You must enter an employee id' FOR employee +
  476.           SUCCEEDS WHERE empid IS NOT NULL
  477.         RULES 'That phone number's been used' FOR employee +
  478.           SUCCEEDS WHERE empphone NOT IN (SELECT empphone +
  479.           FROM employee t1 WHERE t1.empphone = employee.empphone))
  480.         RULES 'That person is already listed.' FOR employee +
  481.           SUCCEEDS WHERE empfname NOT IN (SELECT empfname +
  482.           FROM employee t1 WHERE t1.emplname = employee.emplname)
  483.         RULES 'That ID number is invalid' FOR transmaster +
  484.           SUCCEEDS WHERE empid IN (SELECT empid FROM employee)
  485.         RULES 'The min must be less than max' FOR bonusrate +
  486.           SUCCEEDS WHERE minamount < maxamount
  487.         RULES 'Enter A-1, B-1, C-10, or C-20 as the location' +
  488.           FOR prodlocation SUCCEEDS WHERE location IN +
  489.           ('A-1','B-1','C-10','C-20')
  490.         RULES 'Enter a bonus between 0 & .01' FOR bonusrate +
  491.           SUCCEEDS WHERE bonuspct BETWEEN 0 and .01
  492.         RULES 'Enter 6 characters for Model.' FOR product +
  493.           SUCCEEDS WHERE (SLEN(model))= 6
  494.         RULES 'You must enter a transaction date' FOR salesbonus +
  495.           SUCCEEDS WHERE empid IS NULL OR empid <> 100 OR +
  496.           (empid = 100 AND transdate IS NOT NULL)
  497.  
  498.  
  499.    Using the Menus to Create Rules
  500.    """""""""""""""""""""""""""""""
  501.    To use the menus to create rules, choose "Create/modify" under Info on
  502.    the R:BASE Main Menu after opening a database. Then choose "Create"
  503.    under Rules. Now you can choose one of the default rules (require a
  504.    value, require a unique value, or verify a value), or you can create a
  505.    custom rule.
  506.  
  507.  
  508.    Speed Considerations
  509.    """"""""""""""""""""
  510.    To speed up a single-column uniqueness rule, index the column, and use
  511.    a sub-SELECT in the rule's WHERE clause to test for uniqueness. Put a
  512.    WHERE clause on the sub-SELECT to use the index as we did in the
  513.    examples shown below.
  514.  
  515.    To speed up multi-column uniqueness rules, always add a WHERE clause
  516.    to the sub-SELECT and index the column you use in the sub-SELECT's
  517.    WHERE clause. You don't need to index all the columns--just the one
  518.    used in the sub-SELECT's WHERE clause. For example, this rule ensures
  519.    a unique multi-column combination:
  520.  
  521.  
  522.  
  523.  
  524.    MICRORIM ONLINE February 1991 -------------------------- Page 8 of 31
  525.  
  526.  
  527.  
  528.  
  529.  
  530.         RULES 'That name already exists' +
  531.           FOR contact SUCCEEDS WHERE +
  532.           contfname NOT IN (SELECT +
  533.           contfname FROM contact t1 WHERE +
  534.           t1.contlname = contact.contlname)
  535.  
  536.    An index on CONTLNAME is all that's required. You can change the
  537.    columns around so that you would put an index on CONTFNAME instead of
  538.    CONTLNAME:
  539.  
  540.         RULES 'That name already exists' +
  541.           FOR contact SUCCEEDS WHERE +
  542.           contlname NOT IN (SELECT +
  543.           contlname FROM contact t1 WHERE +
  544.           t1.contfname = contact.contfname)
  545.  
  546.    You can use FAILS instead of SUCCEEDS by changing the NOT IN to IN:
  547.  
  548.         RULES 'That name already exists' +
  549.           FOR contact FAILS WHERE +
  550.           contfname IN (SELECT +
  551.           contfname FROM contact t1 WHERE +
  552.           t1.contlname = contact.contlname)
  553.  
  554.  
  555.    Creating Rules with CREATE TABLE
  556.    """"""""""""""""""""""""""""""""
  557.    The CREATE TABLE command creates rules automatically when you
  558.    associate NOT NULL or UNIQUE with specific columns. It requires that a
  559.    column be defined as NOT NULL before it can be defined as UNIQUE, and
  560.    it always uses SUCCEEDS. For example, the following CREATE TABLE
  561.    creates a multi-column uniqueness rule:
  562.  
  563.         CREATE TABLE likecontact +
  564.           (custid INTEGER, +
  565.           contfname TEXT 10 NOT NULL, +
  566.           contlname TEXT 16 NOT NULL, +
  567.           UNIQUE (contfname, contlname))
  568.  
  569.    The last line causes R:BASE to create a rule with this rule message:
  570.    "(contfname,contlname) must be unique and cannot be null" and this
  571.    WHERE clause:
  572.  
  573.         NOT contfname IN ( SELECT +
  574.           contfname FROM likecontact #table +
  575.           WHERE #table.contlname = +
  576.           likecontact.contlname)
  577.  
  578.  
  579.    Differences from R:BASE for DOS
  580.    """""""""""""""""""""""""""""""
  581.    R:BASE 3.1 and Personal R:BASE rules are different from R:BASE for DOS
  582.    rules. Here's what's new in R:BASE 3.1:
  583.  
  584.      o  You must specify a table for every rule. If a column is common to
  585.         several tables and you want to define a rule for the column, you
  586.         need to create a rule for each table that contains the column.
  587.  
  588.  
  589.  
  590.    MICRORIM ONLINE February 1991 -------------------------- Page 9 of 31
  591.  
  592.  
  593.  
  594.  
  595.  
  596.      o  The SUCCEEDS/FAILS designation is new. R:BASE for DOS always
  597.         assumed SUCCEEDS.
  598.      o  You can have a full WHERE clause. In R:BASE for DOS, you couldn't
  599.         define a multi-column uniqueness rule without using a computed
  600.         column; now you can.
  601.      o  RULES is a command that you enter at the R> prompt.
  602.      o  Now you identify a rule by its message. Rules no longer have rule
  603.         numbers.
  604.      o  Use the menus or DROP RULE to remove a rule.
  605.      o  Error messages can now be 50 characters long.
  606.  
  607.  
  608.    Related Commands
  609.    """"""""""""""""
  610.    These R:BASE 3.1 commands and the WHERE clause also relate to rules:
  611.  
  612.      o  The DROP RULE, LIST RULES, and RBDEFINE commands.
  613.      o  WHERE clauses, conditions, and indexed columns.
  614.      o  The RENAME command--when you rename a table that has an
  615.         associated rule, R:BASE updates the rule definition. But if you
  616.         rename a table used in a rule's WHERE clause or if you rename a
  617.         column, you must update the rule yourself.
  618.      o  The DROP TABLE command--if you delete a table that's associated
  619.         with a rule, R:BASE automatically deletes the rule. But if you
  620.         delete a table used in a rule's WHERE clause, use the DROP RULE
  621.         command to remove the rule, or modify it to use a different
  622.         table.
  623.      o  The BACKUP and UNLOAD (ALL or STRUCTURE) commands--if you don't
  624.         designate a table, these commands unload rules as RULES commands.
  625.  
  626.  
  627.    AND Setting
  628.    """""""""""
  629.    AND is usually ON (the default) and affects all WHERE clauses
  630.    including those used in rules. R:BASE for DOS users aren't used to the
  631.    new AND setting and might expect WHERE clauses to act as if AND were
  632.    set OFF. For example, look at this condition list:
  633.  
  634.         c1=1 OR c1=2 AND c2 IS NOT NULL
  635.  
  636.    R:BASE for DOS reads from left to right, so R:BASE for DOS sees this:
  637.  
  638.         (c1=1 OR c1=2) AND c2 IS NOT NULL
  639.  
  640.    However, with AND set ON, R:BASE 3.1 and Personal R:BASE see this:
  641.  
  642.         c1=1 OR (c1=2 AND c2 IS NOT NULL)
  643.  
  644.    This can cause different results. Set AND OFF if you want R:BASE to
  645.    read from left to right, or use parentheses in WHERE clauses to remove
  646.    ambiguity.
  647.  
  648.    R:BASE 3.1 and Personal R:BASE don't store the AND setting with the
  649.    database, so it will always be ON when you start R:BASE unless you
  650.    store the setting in your RBASE.CFG file.
  651.  
  652.  
  653.  
  654.  
  655.  
  656.    MICRORIM ONLINE February 1991 -------------------------- Page 10 of 31
  657.  
  658.  
  659.  
  660.  
  661.  
  662.    Nulls
  663.    """""
  664.    A null value is never equal to another null value in a comparison. For
  665.    example, consider these conditions:
  666.  
  667.         c1 <> c2 AND c1 <> c3 AND c1 <> c4
  668.  
  669.    The rule will break if any of the columns (C1, C2, C3, or C4) are null
  670.    because if either side of any comparison is a null value, the
  671.    comparison will evaluate as false.
  672.  
  673.    Here's an alternative that allows a null value in any of the columns
  674.    but still ensures that the value in C1 isn't equal to any of the other
  675.    column values:
  676.  
  677.         RULE 'C1 can't equal C2, C3, or C4' +
  678.           FOR tblname SUCCEEDS WHERE +
  679.           c1 IS NULL OR +
  680.           ((c1 <> c2 OR c2 IS NULL) AND +
  681.           (c1 <> c3 OR c3 IS NULL) AND +
  682.           (c1 <> c4 OR c4 IS NULL))
  683.  
  684.    In order to meet SQL requirements, R:BASE won't allow you to add new
  685.    values to a column that has a rule requiring unique values if that
  686.    column contains any null values. R:BASE lets you create the rule, but
  687.    you won't be able to add new unique values until you remove all
  688.    existing null values from the column. That's why CREATE TABLE requires
  689.    a column to be defined as NOT NULL before it's defined as UNIQUE.
  690.  
  691.  
  692.    Adding Rows While Editing
  693.    """""""""""""""""""""""""
  694.    If you try to add a row by choosing "Insert row" under Edit while
  695.    editing using the Info/Views menu (brought up from the menu or by EDIT
  696.    ALL) and you have any rule defined for that table, R:BASE won't let
  697.    you do it. This is because R:BASE evaluates rules when you try to add
  698.    the row. Because R:BASE is adding a null row, almost any rule breaks
  699.    immediately. The same thing happens if you choose "Add row" while
  700.    editing with a form.
  701.  
  702.    You can work around this, but it isn't recommended because you'd
  703.    either have to turn rule checking off or you'd have to allow null
  704.    values by including that as a primary qualifying condition in the
  705.    rule's WHERE clause.
  706.  
  707.  
  708.    Rule Breaks While Editing
  709.    """""""""""""""""""""""""
  710.    When you change a value while editing under the Info/Views menu,
  711.    R:BASE checks all the rules for the entire row. If some other column
  712.    violates a rule, you must press [F5] to reset the value of the column
  713.    you tried to change, then correct the value that violated the rule,
  714.    and then go back and make your original change. You need to do it this
  715.    way because R:BASE checks all the rules for the table as soon as you
  716.    change a column value.
  717.  
  718.  
  719.  
  720.  
  721.  
  722.    MICRORIM ONLINE February 1991 -------------------------- Page 11 of 31
  723.  
  724.  
  725.  
  726.  
  727.  
  728.    If more than one column violates a rule, you won't be able to fix the
  729.    problem in the Info/Views menu. To correct it, use a form or set rule
  730.    checking OFF, correct the problem, then set rule checking back ON.
  731.  
  732.    Why is there data in the row that breaks rules? There are two
  733.    possibilities. The data could have been entered when rule checking was
  734.    turned off, or the rule could have been created after the data was
  735.    already loaded.
  736.  
  737.  
  738.    UPDATE Command & Rules
  739.    """"""""""""""""""""""
  740.    When you use UPDATE to change a column value, R:BASE works as it does
  741.    when editing under the Info/Views menu. Even though you change only
  742.    one or two columns, R:BASE checks the rules on all the columns in the
  743.    row.
  744.  
  745.    If a rule breaks, UPDATE doesn't continue to process the rest of the
  746.    rows that should be changed. If this happens, R:BASE sets SQLCODE to -
  747.    2227 and sets the error variable (if it exists) to 2227. If you use
  748.    the following commands to show the error, you'll find it's set to the
  749.    rule error message:
  750.  
  751.         SET VAR vmsg = 2227
  752.         SHOW ERROR vmsg
  753.  
  754.  
  755.    INSERT Command & Rules
  756.    """"""""""""""""""""""
  757.    If you're using the INSERT command or the undocumented APPEND command
  758.    to add new rows to a table, all rows are added to the destination
  759.    table except for the rows that break a rule. These commands don't stop
  760.    after encountering a row that breaks a rule. When a row breaks a rule,
  761.    INSERT sets SQLCODE and the error variable to -2227 and APPEND leaves
  762.    SQLCODE as zero and changes the error variable to 2227.
  763.  
  764.    R:BASE rules keep tight control over what does and doesn't get into
  765.    your database.
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.    MICRORIM ONLINE February 1991 -------------------------- Page 12 of 31
  789.  
  790.  
  791.  
  792.  
  793.  
  794.    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  795.    CONVERT DOLLARS TO WORDS IN A FORM WHILE ENTERING CHECKS
  796.    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  797.    PRODUCT   :  R:BASE                  VERSION      :  3.1
  798.    CATEGORY  :  PROGRAMMING             SUBCATEGORY  :  TOOLS
  799.    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  800.  
  801.    The January/February 1991 issue of R:BASE EXCHANGE gave you
  802.    NUM2WORD.CMD. Now that program has been adapted to make it an
  803.    entry/exit procedure (EEP) in a form. NUM2WORD.EEP writes out the
  804.    CURRENCY amount in words as you enter data. When you leave the typing
  805.    to the computer, the data entry operator can focus on entering the
  806.    correct CURRENCY amount.
  807.  
  808.  
  809.    Requirements & Assumptions
  810.    """"""""""""""""""""""""""
  811.    For this particular program to work, the CURRENCY value must be in the
  812.    range from $0.01 to $99,999.99. The EEP creates and plays a playback
  813.    (script) file to load the TEXT value.
  814.  
  815.    NUM2WORD.EEP assumes that the table NUM_TO_WORD already exists in the
  816.    database. If you don't have it in your database, connect the database
  817.    and run this short command file:
  818.  
  819.         *( MAKE_TBL.CMD--Create and load )
  820.         *( NUM_TO_WORD table.)
  821.         CREATE TABLE num_to_word +
  822.           (znum INTEGER, zword TEXT 9)
  823.         LOAD num_to_word
  824.         0,' ';1,'One';2,'Two';3,'Three';4,'Four'
  825.         5,'Five';6,'Six';7,'Seven';8,'Eight';9,'Nine'
  826.         10,'Ten';11,'Eleven';12,'Twelve'
  827.         13,'Thirteen';14,'Fourteen';15,'Fifteen'
  828.         16,'Sixteen';17,'Seventeen';18,'Eighteen'
  829.         19,'Nineteen';20,'Twenty';30,'Thirty'
  830.         40,'Forty';50,'Fifty';60,'Sixty';70,'Seventy'
  831.         80,'Eighty';90,'Ninety'
  832.         END
  833.  
  834.  
  835.    Listing of NUM2WORD.EEP
  836.    """""""""""""""""""""""
  837.  
  838.    *( NUM2WORD.EEP--writes out CURRENCY value of $0.01 to )
  839.    *( $99,999.99 in words. Value is passed in by VCURAMT.)
  840.    *( It assumes the table NUM_TO_WORD already exists.)
  841.    SET ERROR MESSAGE OFF
  842.    SET MESSAGE OFF
  843.    SET ZERO ON
  844.    IF vcuramt > $99999.99 or vcuramt < .01 THEN
  845.      SET VAR vstring TEXT = +
  846.        '-ERROR- Your value must be between $0.01 and $99,999.99.'
  847.      GOTO errstop
  848.    ENDIF
  849.      SET VAR vstring TEXT = NULL, vdash TEXT, vzero TEXT='0'
  850.  
  851.  
  852.  
  853.  
  854.    MICRORIM ONLINE February 1991 -------------------------- Page 13 of 31
  855.  
  856.  
  857.  
  858.  
  859.  
  860.      SET VAR vtxtamt=(CTXT(.vcuramt)), +
  861.        vtot=(11 - (SLEN(.vtxtamt))), vhold=(SFIL('#',.vtot)), +
  862.        vhold=(.vhold + .vtxtamt)
  863.      CLEAR VAR vtxtamt, vtot
  864.      SET VAR vpos INTEGER = ((SLOC(.vhold,'$')) + 1)
  865.      GOTO &vpos
  866.    LABEL 2  *( Do hundred thousands and hundreds )
  867.    LABEL 6
  868.      SET VAR vnum TEXT = (SGET(.vhold,1,.vpos))
  869.      SET VAR vsub TEXT = zword IN num_to_word +
  870.        WHERE znum = .vnum
  871.      SET VAR vstring TEXT = (.vstring & .vsub)
  872.      IF vnum <> '0' THEN
  873.        SET VAR vstring = (.vstring & 'Hundred')
  874.      ENDIF
  875.      SET VAR vpos = (.vpos + 1)
  876.      GOTO &vpos
  877.    LABEL 3  *( Do ten thousands and tens columns )
  878.    LABEL 7
  879.      SET VAR vnum = (SGET(.vhold,2,.vpos)), vdash = ' '
  880.      IF vnum >= '20' THEN
  881.        SET VAR vtot INTEGER = .vnum
  882.        IF (MOD(.vtot,10)) > 0 THEN
  883.          SET VAR vdash TEXT = '-'
  884.          SET VAR vnum = (SPUT(.vnum,.vzero,2))
  885.        ENDIF
  886.      ELSE
  887.        SET VAR vpos = (.vpos + 2)
  888.      ENDIF
  889.      SET VAR vnum INTEGER
  890.      SET VAR vsub = zword IN num_to_word +
  891.        WHERE znum=.vnum
  892.      SET VAR vstring = (.vstring & .vsub + .vdash)
  893.      IF vpos = 5 THEN
  894.        SET VAR vstring TO (.vstring & 'Thousand')
  895.      ENDIF
  896.      SET VAR vpos = (.vpos + 1), vnum TEXT
  897.      GOTO &vpos
  898.    LABEL 4  *( Do thousands and ones columns )
  899.    LABEL 8
  900.      SET VAR vnum = (SGET(.vhold,1,.vpos))
  901.      SET VAR vsub = zword IN num_to_word +
  902.        WHERE znum = .vnum
  903.      SET VAR vstring = (.vstring + .vsub)
  904.      IF vpos = 4 THEN
  905.        SET VAR vstring = (.vstring & 'Thousand')
  906.      ENDIF
  907.      SET VAR vpos = (.vpos + 2)
  908.      GOTO &vpos
  909.    LABEL 10  *( Do the pennies )
  910.    LABEL 11
  911.      SET VAR vnum = (SGET(.vhold,2,.vpos))
  912.      IF vnum = '00' THEN
  913.        SET VAR vnum = 'no'
  914.      ENDIF
  915.      SET VAR vstring = (.vstring & 'and' & .vnum + '/100 Dollars')
  916.      SET VAR vtot INTEGER = (SLEN(.vstring))
  917.  
  918.  
  919.  
  920.    MICRORIM ONLINE February 1991 -------------------------- Page 14 of 31
  921.  
  922.  
  923.  
  924.  
  925.  
  926.      IF vtot <= 20 THEN
  927.        SET VAR vstring = ('Zero' & .vstring)
  928.      ENDIF
  929.    LABEL errstop
  930.    *( Add control characters to clear the field, write the CURRENCY)
  931.    *( amount in the field, and move on to the next field in the form.)
  932.    SET VAR vstring = (CHAR(0) + CHAR(92) + .vstring +
  933.      + CHAR(13) + CHAR(0) + CHAR(95))
  934.    OUTPUT num2word.pla  *(Create the playback file.)
  935.    WRITE .vstring
  936.    OUTPUT SCREEN  *( Close the playback file.)
  937.    CLEAR VAR vdash, vzero, vtable, vcol, vtxtcol, vyn, +
  938.      vpos, vnum, vhold, vtot, vsub, vstring
  939.    PLAYBACK num2word.pla  *( Play the playback file.)
  940.    RETURN
  941.  
  942.  
  943.    Example Checking Form
  944.    """""""""""""""""""""
  945.    Here's a rough sketch of an example form that might use NUM2WORD.EEP.
  946.    A better picture of this form is shown in the March/April 1991 R:BASE
  947.    EXCHANGE.
  948.  
  949.    +--------------------------------------------------------------------------+
  950.    |                                                              _________   |
  951.    |   Concomp Computer Corporation    Date: 01/14/91   Check #: [_________]  |
  952.    |        123 Main Street                                                   |
  953.    |       Seattle, WA 98107                                                  |
  954.    |                                                                          |
  955.    | Pay to the  _________________________________         _________________  |
  956.    |  order of: [_________________________________]       [ $0.00___________] |
  957.    |  ______________________________________________________________________  |
  958.    | [______________________________________________________________________] |
  959.    |                                                                          |
  960.    |        _________________________                                         |
  961.    | Memo: [_________________________]        ------------------------------  |
  962.    |                                                                          |
  963.    +--------------------------------------------------------------------------+
  964.  
  965.  
  966.    Locate VCURAMT (a CURRENCY variable) in the form to collect the
  967.    CURRENCY value to be converted. In the form shown above, the field
  968.    with the $0.00 in it is the field location for the CURRENCY variable
  969.    VCURAMT. The long field right beneath that is the field location for
  970.    the column CURTEXT that has NUM2WORD.EEP as an entry procedure.
  971.  
  972.    You need to locate a CURRENCY variable instead of locating a column in
  973.    order to pass the CURRENCY value to the EEP. Customize the field
  974.    characteristics for VCURAMT to give it a default value of $0.00. This
  975.    forces the data entry operator to enter a value by hand.
  976.  
  977.    Define the following two expressions for the table:
  978.  
  979.         vstring = ' '
  980.         check_amount = .vcuramt
  981.  
  982.  
  983.  
  984.  
  985.  
  986.    MICRORIM ONLINE February 1991 -------------------------- Page 15 of 31
  987.  
  988.  
  989.  
  990.  
  991.  
  992.    VSTRING initializes the EEP's TEXT string to a blank. CHECK_AMOUNT
  993.    loads the column CHECK_AMOUNT with the CURRENCY amount. In your form,
  994.    change CHECK_AMOUNT to the name of your CURRENCY column.
  995.  
  996.    Next, locate the TEXT column (CURTEXT in this case) that holds the
  997.    converted TEXT value. Customize the field characteristics to make
  998.    NUM2WORD.EEP its entry procedure.
  999.  
  1000.  
  1001.    Using the Form
  1002.    """"""""""""""
  1003.    To use the form, enter this command:
  1004.  
  1005.         ENTER checking
  1006.  
  1007.    You'll see NUM2WORD.EEP convert the CURRENCY values passed to it in
  1008.    the CURRENCY variable VCURAMT. NUM2WORD.EEP is the entry procedure for
  1009.    the TEXT column (CURTEXT in this case) that you want to load with the
  1010.    amount in English words.
  1011.  
  1012.  
  1013.    The Playback File
  1014.    """""""""""""""""
  1015.    NUM2WORD.EEP creates a playback (script) file called NUM2WORD.PLA in
  1016.    order to automatically write the TEXT value into the TEXT column in
  1017.    the form. It does this by adding CHAR(0) and CHAR(95) to the end of
  1018.    the string (VSTRING) that contains the dollar value written out in
  1019.    words. The playback file writes the words for you when the EEP returns
  1020.    control to the form.
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.    MICRORIM ONLINE February 1991 -------------------------- Page 16 of 31
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  1059.    BUILD dBASE INDEX & DATA FILES IN R:BASE 3.1
  1060.    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  1061.    PRODUCT   :  R:BASE                  VERSION      :  3.1
  1062.    CATEGORY  :  dBASE FILES             SUBCATEGORY  :  INDEX & DATA FILE
  1063.    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  1064.  
  1065.    By using two R:BASE command files (MAKE_NDX.CMD & MAKE_DBF.CMD), you
  1066.    can create, in R:BASE, a dBASE index file for an existing dBASE data
  1067.    file or create a new dBASE data file.
  1068.  
  1069.    R:BASE 3.1 can attach dBASE III, dBASE III Plus, and dBASE IV data
  1070.    files (.DBF files) directly to your R:BASE database--even while those
  1071.    same files are attached to other R:BASE or dBASE databases. R:BASE 3.1
  1072.    can also attach dBASE III or dBASE III Plus index files (.NDX files).
  1073.    By attaching dBASE data and index files to an R:BASE database, dBASE
  1074.    and R:BASE users can share, add to, update, and delete from the same
  1075.    information at the same time.
  1076.  
  1077.  
  1078.    Create a dBASE .NDX File
  1079.    """"""""""""""""""""""""
  1080.    MAKE_NDX.CMD is an R:BASE 3.1 program that builds a dBASE III or dBASE
  1081.    III Plus index file (.NDX file) for an existing .DBF file that's
  1082.    currently attached to an R:BASE database. By creating an index file
  1083.    for your dBASE data, you can speed up access.
  1084.  
  1085.    After you build the index file, it will work in both dBASE and R:BASE.
  1086.    That means both R:BASE and dBASE will update the index file just as if
  1087.    it had been created in dBASE. This is a great way to speed up your
  1088.    attached dBASE data files when you don't own dBASE or don't want to
  1089.    learn how to create an index in dBASE.
  1090.  
  1091.    MAKE_NDX.CMD shows how to accomplish the following in R:BASE 3.1:
  1092.  
  1093.      o  Build and activate a dBASE index file for a dBASE data file.
  1094.      o  Use the CHAR function to actually create the binary file you'll
  1095.         need.
  1096.      o  Use the undocumented RESET option on the CREATE INDEX or BUILD
  1097.         KEY command to build and reset the index.
  1098.      o  Use the CVAL function to get the current settings.
  1099.      o  Use the error variable to check for the existence of a file.
  1100.      o  Create a menu of attached dBASE files, so you can choose the one
  1101.         to be indexed. This uses a #DBASE undocumented menu file feature.
  1102.  
  1103.    Before running MAKE_NDX.CMD, connect the database and attach the dBASE
  1104.    data file you want to index.
  1105.  
  1106.  
  1107.    *( MAKE_NDX.CMD--Create dBASE index file for dBASE data.)
  1108.    CLS ; *( Save and set current R:BASE settings.)
  1109.    SET VAR quote TEXT = quotes, vquote TEXT = (CVAL(.quote))
  1110.    SET QUOTES = '
  1111.    SET VAR vmess TEXT = (CVAL('MESSAGE'))
  1112.    SET MESSAGE OFF
  1113.    SET VAR verror TEXT = (CVAL('ERROR'))
  1114.    SET ERROR MESSAGE OFF
  1115.  
  1116.  
  1117.  
  1118.    MICRORIM ONLINE February 1991 -------------------------- Page 17 of 31
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.    SET VAR vbell TEXT = (CVAL('BELL')); SET BELL OFF
  1125.    *( Choose the file-table you want to index.)
  1126.    SET VAR vtable TEXT
  1127.    OUTPUT temp_fil.$$$
  1128.    WRITE 'TITLE'
  1129.    WRITE 'POPUP |Choose the dBASE table to be indexed:|'
  1130.    WRITE '#DBASE'  *( Undocumented feature )
  1131.    OUTPUT SCREEN
  1132.    CHOOSE vtable FROM temp_fil.$$$
  1133.    ERASE temp_fil.$$$
  1134.    IF vtable = '[Esc]' OR vtable IS NULL THEN
  1135.      GOTO done
  1136.    ENDIF
  1137.    *( Choose the column to be indexed.)
  1138.    CLEAR VAR vcolname
  1139.    SET VAR vcolname TEXT
  1140.    CHOOSE vcolname FROM #COLUMNS IN .vtable CASCADE
  1141.    IF vcolname = '[Esc]' OR vcolname IS NULL THEN
  1142.      GOTO done
  1143.    ENDIF
  1144.    REMOVE temp_tbl  *( Make temp table to hold column.)
  1145.    PROJECT temp_tbl FROM &vtable USING &vcolname +
  1146.      WHERE COUNT = 0
  1147.    OUTPUT temp_fil.$$$  *( Extract data type and length.)
  1148.    LIST temp_tbl
  1149.    OUTPUT SCREEN
  1150.    REMOVE temp_tbl
  1151.    *( Read the data from the file into a temporary table.)
  1152.    CREATE TABLE temp_tbl (temp_col TEXT 80)
  1153.    *( Load data.)
  1154.    SET VAR vblank TEXT = (CVAL('BLANK'))
  1155.    SET BLANK = !
  1156.    LOAD,temp_tbl,FROM,temp_fil.$$$
  1157.    SET,BLANK,=,.vblank
  1158.    ERASE temp_fil.$$$
  1159.    *( Extract the data type and length.)
  1160.    CLEAR VAR vtemp, vtype, vlength
  1161.    SET VAR vtemp TEXT = temp_col IN temp_tbl +
  1162.      WHERE COUNT = 6
  1163.    SET VAR vtype TEXT = (SMOVE(.vtemp,25,7,.vtype,1))
  1164.    IF VTYPE = 'TEXT' THEN
  1165.      SET VAR vlength TEXT = (SMOVE(.vtemp,32,2,.vlength,1))
  1166.      SET VAR vlength INTEGER
  1167.    ENDIF
  1168.    REMOVE temp_tbl
  1169.    SET VAR vfile TEXT = (.vcolname + '.ndx')
  1170.    *( Make sure this .NDX file doesn't already exist.)
  1171.    SET ERROR VAR vstatus
  1172.    COPY .vfile NUL
  1173.    IF vstatus = 0 THEN
  1174.      DIALOG 'Enter a unique name for .NDX file: ' vfile vtemp 1
  1175.    ENDIF
  1176.    CLEAR VAR vtemp, vblank, vstatus
  1177.    *( Create the new .NDX file using VCOLNAME for name, VTYPE)
  1178.    *( for data type, VLENGTH for length for TEXT, and VFILE for)
  1179.    *( file name. First, make the string needed for the initial block.)
  1180.  
  1181.  
  1182.  
  1183.  
  1184.    MICRORIM ONLINE February 1991 -------------------------- Page 18 of 31
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.    SET VAR vtemp TEXT = (CHAR(0)), +
  1191.      vroot TEXT = (SFIL(.vtemp, 254)), vtemp = (CHAR(1)), +
  1192.      vroot = (SMOVE(.vtemp,1,1,.vroot,1)), vtemp = (CHAR(2)), +
  1193.      vroot = (SMOVE(.vtemp,1,1,.vroot,5)), +
  1194.      vroot = (SMOVE(.vcolname,1,18,.vroot,25)), vtemp = 'TEXT'
  1195.    IF vtype <> .vtemp THEN
  1196.      SET VAR vtemp = (CHAR(1)), +
  1197.        vroot = (SMOVE(.vtemp,1,1,.vroot,17)), +
  1198.        vtemp = (CHAR(8)), vmax INTEGER = (502 / 12)
  1199.    ELSE
  1200.      SET VAR vtemp = (CHAR(.vlength))
  1201.      SET VAR vmax INTEGER = (512 / (.vlength + 4))
  1202.    ENDIF
  1203.    SET VAR vroot = (SMOVE(.vtemp,1,1,.vroot,13)), +
  1204.      vtemp = (CHAR(.vmax)), +
  1205.      vroot = (SMOVE(.vtemp,1,1,.vroot,15)), +
  1206.      vtemp = (CHAR(16)), vroot = (SMOVE(.vtemp,1,1,.vroot,19)), +
  1207.      vtemp = (CHAR(1)), vroot = (SMOVE(.vtemp,1,1,.vroot,21))
  1208.    *( Write it out.)
  1209.    OUTPUT .vfile
  1210.    SET WIDTH 256
  1211.    WRITE .vroot
  1212.    SET VAR vtemp = (CHAR(0)), vroot = (SFIL(.vtemp, 254))
  1213.    WRITE .vroot
  1214.    SET VAR vroot = (SFIL(.vtemp, 254))
  1215.    WRITE .vroot
  1216.    SET VAR vroot = (SFIL(.vtemp, 253))
  1217.    WRITE .vroot
  1218.    OUTPUT SCREEN
  1219.    SET WIDTH 79
  1220.    CLEAR VAR vroot, vtemp, vmax
  1221.    *( Attach this index using the file-table.)
  1222.    ATTACH .vtable USING .vfile
  1223.    *( Load the index values using an undocumented feature.)
  1224.    BUILD KEY FOR .vcolname IN .vtable RESET
  1225.    LABEL done
  1226.    *( Restore the original R:BASE settings.)
  1227.    SET QUOTE = .vquote
  1228.    SET MESSAGE .vmess
  1229.    SET ERROR MESSAGE .verror
  1230.    SET BELL .vbell
  1231.    CLEAR VAR quote, vquote, vmess, verror, vbell
  1232.  
  1233.  
  1234.    Create a Small .DBF File
  1235.    """"""""""""""""""""""""
  1236.    MAKE_DBF.CMD is an R:BASE 3.1 program that creates an empty dBASE data
  1237.    file (.DBF file) without using dBASE or the GATEWAY import/export tool
  1238.    in R:BASE. Once you create the .DBF file, you can attach it to an
  1239.    R:BASE database and load it with data by using INSERT, ENTER form, or
  1240.    LOAD.
  1241.  
  1242.    You can use the dBASE file as a temporary table--attaching and
  1243.    detaching it as needed--without increasing the overall size of the
  1244.    R:BASE database, in other words, without increasing the size of
  1245.    database file 2.
  1246.  
  1247.  
  1248.  
  1249.  
  1250.    MICRORIM ONLINE February 1991 -------------------------- Page 19 of 31
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.    Also, in a multi-user R:BASE environment, multiple R:BASE databases
  1257.    can attach and share a .DBF file.
  1258.  
  1259.    MAKE_DBF.CMD builds a small (up to six columns), empty dBASE data file
  1260.    (.DBF file) to act as a temporary table or to hold data shared by two
  1261.    or more R:BASE databases. Connect the database before you run
  1262.    MAKE_DBF.CMD, and after running it, attach the new .DBF file to your
  1263.    R:BASE database.
  1264.  
  1265.    *( MAKE_DBF.CMD--Create new dBASE file w/ up to 6 columns.)
  1266.    CLS  *( Save and set current R:BASE settings.)
  1267.    SET VAR quote TEXT = quotes, vquote TEXT = (CVAL(.quote))
  1268.    SET QUOTE = '
  1269.    SET VAR vmess TEXT=(CVAL('message')); SET MESSAGE OFF
  1270.    SET VAR verror TEXT=(CVAL('error')); SET ERR MESSAGE OFF
  1271.    SET VAR vbell TEXT = (CVAL('bell')); SET BELL OFF
  1272.    SET VAR vfile TEXT  *( Get the name of the file to use)
  1273.    FILLIN vfile=8 USING 'Enter the name for the .DBF file: '
  1274.    IF vfile = '[Esc]' OR vfile IS NULL THEN ; GOTO done ; ENDIF
  1275.    IF vfile NOT CONT '.dbf' THEN ; SET VAR vfile=(.vfile+'.dbf')
  1276.    ENDIF
  1277.    SET error var vstatus ; COPY .vfile NUL IF vstatus = 0 THEN
  1278.      DIALOG 'Enter a unique name for the .DBF file: ' vfile vtemp 1
  1279.    ENDIF
  1280.    CLEAR VAR vtemp, vblank, vstatus
  1281.    *( Find out how many columns are wanted.)
  1282.    SET VAR vncol INTEGER, vrowsize INTEGER
  1283.    FILLIN vncol=2 USING 'How many columns are in this .DBF file? '
  1284.    IF vncol <= 0 OR vncol IS NULL THEN ; GOTO done ; ENDIF
  1285.    IF vncol > 6 THEN
  1286.      WRITE 'A maximum number of 6 columns can be defined.'
  1287.      GOTO done
  1288.    ENDIF
  1289.    *( Make the string needed for the initial block and zero fill it.)
  1290.    *( Add the version number and date.)
  1291.    SET VAR vrowsize=0, vtemp TEXT=(CHAR(0)), +
  1292.      vroot TEXT=(SFIL(.vtemp, 254)), vtemp=(CHAR(3)), +
  1293.      vroot=(SMOVE(.vtemp,1,1,.vroot,1)), vyr = (IYR(.#DATE))
  1294.    IF vyr > 1900 THEN ; SET VAR vyr = (.vyr - 1900) ; ENDIF
  1295.    SET VAR vtemp = (CHAR(.vyr)), +
  1296.      vroot = (SMOVE(.vtemp,1,1,.vroot,2)), +
  1297.      vmon = (IMON(.#DATE)), vtemp = (CHAR(.vmon)), +
  1298.      vroot=(SMOVE(.vtemp,1,1,.vroot,3)), vday = (IDAY(.#DATE)), +
  1299.      vtemp = (CHAR(.vday)), vroot = (SMOVE(.vtemp,1,1,.vroot,4))
  1300.    CLEAR VAR vyr, vmon, vday  *( Add the header size.)
  1301.    SET VAR vhdrbyt=(((.vncol + 1) * 32) + 1), +
  1302.      vtemp=(CHAR(.vhdrbyt)), vroot=(SMOVE(.vtemp,1,1,.vroot,9))
  1303.    OUTPUT temp_fil.$$$  *( Create menu for data types.)
  1304.    WRITE 'TITLE'
  1305.    WRITE 'POPUP |Choose the data type for the column:|'
  1306.    WRITE 'Character |For TEXT and TIME columns|'
  1307.    WRITE 'Number |For INTEGER, REAL, DOUBLE, CURRENCY, +
  1308.    and NUMERIC |'
  1309.    WRITE 'Date |For DATE columns|'
  1310.    OUTPUT screen  *( Do the columns)
  1311.    SET VAR vname TEXT, vtype TEXT, vlength INTEGER, +
  1312.      vcount INT = 0, vloc INT = 33, voffset = 10, vline = 6
  1313.  
  1314.  
  1315.  
  1316.    MICRORIM ONLINE February 1991 -------------------------- Page 20 of 31
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.    WRITE 'Column definitions'
  1323.    *(          6 blanks      12 blanks        2 blanks)
  1324.    WRITE 'Name      Type            Total length  Scale'
  1325.    WRITE '--------  ----            ------------  -----'
  1326.    WHILE vcount < .vncol THEN
  1327.      *( Get the column name, data type, and length. FILLIN...USING '')
  1328.      *( commands are using two single quotation marks, not a double.)
  1329.      FILLIN vname=8 USING '' AT .vline 1 black ON gray
  1330.      SET VAR vname = (LUC(.vname))
  1331.      CHOOSE vtype FROM temp_fil.$$$ AT .vline 11
  1332.      IF vtype = '[Esc]' OR vtype IS NULL THEN ; GOTO done ; ENDIF
  1333.      SET VAR vtype = (SGET(.vtype,1,1)), vscale = 0
  1334.      IF vtype = 'D' THEN ; SET VAR vlength = 8
  1335.      ELSE ; FILLIN vlength=3 USING '' AT .vline 27 black ON gray
  1336.        IF vtype = 'N' THEN
  1337.          FILLIN vscale=2 USING '' AT .vline 41 black ON gray
  1338.        ENDIF
  1339.      ENDIF
  1340.      *( Add the name, data type, and offset.)
  1341.      SET VAR vl=(SLEN(.vname)), +
  1342.        vroot=(SMOVE(.vname,1,.vl,.vroot,.vloc)), +
  1343.        vl=(.vloc + 11), vroot=(SMOVE(.vtype,1,1,.vroot,.vl)), +
  1344.        vtemp=(CHAR(.voffset)),vl=(.vloc + 12), +
  1345.        vroot=(SMOVE(.vtemp,1,1,.vroot,.vl))
  1346.      *( Add segment, overall length, digits to right of decimal point.)
  1347.      SET VAR vsegment='J', vl=(.vloc + 14), +
  1348.        vroot=(SMOVE(.vsegment,1,2,.vroot,.vl)), +
  1349.        vtemp=(CHAR(.vlength)), vl=(.vloc + 16), +
  1350.        vroot=(SMOVE(.vtemp,1,1,.vroot,.vl)), +
  1351.        vtemp=(CHAR(.vscale)), vl=(.vloc + 17), +
  1352.        vroot=(SMOVE(.vtemp,1,1,.vroot,.vl))
  1353.      *( Add the work area identification.)
  1354.      SET VAR vtemp = (CHAR(1)), vl = (.vloc + 20), +
  1355.        vroot = (SMOVE(.vtemp,1,1,.vroot,.vl)), +
  1356.        vrowsize = (.vrowsize + .vlength), vloc = (.vloc + 32) +
  1357.        voffset = (.voffset + .vlength), vcount = (.vcount + 1)
  1358.      CLS FROM .vline ; SHOW VAR vname=8 AT .vline 1
  1359.      SHOW VAR vtype=1 AT .vline 11
  1360.      IF vtype <> 'D' THEN ; SHOW VAR vlength=3 AT .vline 27
  1361.        IF vtype = 'N' THEN ; SHOW VAR vscale=2 AT .vline 41 ; ENDIF
  1362.      ENDIF ; SET VAR vline = (.vline + 1)
  1363.    ENDWHILE
  1364.    IF vrowsize >= 256 THEN  *( Add row size and last header byte.)
  1365.      WRITE 'The row size is limited to 256 bytes.' ; GOTO done
  1366.    ENDIF
  1367.    SET VAR vtemp=(CHAR(.vrowsize)), +
  1368.      vroot=(SMOVE(.vtemp,1,1,.vroot,11)), vtemp=(CHAR(13)), +
  1369.      vroot=(SMOVE(.vtemp,1,1,.vroot,.vloc))
  1370.    ERASE temp_fil.$$$ ; SET WIDTH 256  *( Write it out.)
  1371.    OUTPUT .vfile ; WRITE .vroot ; OUTPUT SCREEN
  1372.    SET WIDTH 79 ; CLEAR VAR vroot, vtemp
  1373.    LABEL done  *( Restore the original R:BASE settings.)
  1374.    SET QUOTE = .vquote ; SET MESSAGE .vmess
  1375.    SET ERROR MESSAGE .verror ; SET BELL .vbell
  1376.    CLEAR VAR quote, vquote, vmess, verror, vbell, vfile, vncol, +
  1377.      vrowsize, vhdrbyt, vname, vtype, vlength, vcount, vloc, voffset, +
  1378.      vline, vscale, vl, vsegment
  1379.  
  1380.  
  1381.  
  1382.    MICRORIM ONLINE February 1991 -------------------------- Page 21 of 31
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  1389.    FEBRUARY 1991 PROBLEMS AND WORKAROUNDS
  1390.    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  1391.    PRODUCT   :  R:BASE                  VERSION      :  3.1
  1392.              :  DB Graphics                          :  1.0
  1393.    CATEGORY  :  BUGS/WORKAROUNDS        SUBCATEGORY  :  PROBLEMS/ANOMALIES
  1394.    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  1395.    Here are workarounds for verified problems in Microrim products. The
  1396.    version number listed is the one in which the problem was found.
  1397.  
  1398.    +----------------+
  1399.    |                |
  1400.    |   R:BASE 3.1   |
  1401.    |                |
  1402.    +----------------+
  1403.  
  1404.    Application EXPRESS
  1405.    """""""""""""""""""
  1406.    When developing an application in Application EXPRESS, if you specify
  1407.    IN as the operator for the WHERE clause and enter a list of comparison
  1408.    values, R:BASE will correctly put parentheses around the list of
  1409.    values. But if you specify IN as the operator and tell Application
  1410.    EXPRESS to get the values from the user, the user will experience a
  1411.    problem when running the application.
  1412.  
  1413.    When the user runs the application and enters a value, R:BASE gives an
  1414.    error telling the user that parentheses are required around a list of
  1415.    items. This error occurs because Application EXPRESS wrote this code:
  1416.  
  1417.         ...WHERE colname IN .WHVAL0
  1418.  
  1419.    To execute correctly, R:BASE should have written &WHVAL0 instead of
  1420.    .WHVAL0--an ampersand variable instead of a dotted variable. Even if
  1421.    the user includes parentheses and commas in the value list, R:BASE
  1422.    will still give the error message.
  1423.  
  1424.    WORKAROUND:  There are many possible workarounds. Here are three:
  1425.  
  1426.      o  After developing the application, you can change the code in the
  1427.         .APP file and use CODELOCK to make a new .APX file.
  1428.      o  Give a list of values when you're developing the application.
  1429.      o  Write your own custom code or macro to collect the values, and
  1430.         add it to your application using Application EXPRESS.
  1431.  
  1432.  
  1433.  
  1434.    [F9] in Application EXPRESS
  1435.    """""""""""""""""""""""""""
  1436.    When developing an application in Application EXPRESS, if you press
  1437.    [F9] to delete options from a menu in Application EXPRESS, R:BASE
  1438.    moves the text of the deleted option to a different location on the
  1439.    menu overwriting other menu options. But R:BASE saves the menu
  1440.    correctly, and if you move the cursor back through all the menu
  1441.    options, the menu will reconstruct itself correctly.
  1442.  
  1443.    WORKAROUND:  This is a display problem in Application EXPRESS that you
  1444.    can clear by moving the cursor back through the menu. Even if you
  1445.  
  1446.  
  1447.  
  1448.    MICRORIM ONLINE February 1991 -------------------------- Page 22 of 31
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.    don't move the cursor back, R:BASE saves the menu correctly. The menu
  1455.    will display correctly when your application is used.
  1456.  
  1457.  
  1458.  
  1459.    Pull-down Menu & App EXPRESS
  1460.    """"""""""""""""""""""""""""
  1461.    Application EXPRESS writes incorrect SET VAR commands after the CHOOSE
  1462.    command when you create an application with a pull-down main menu. The
  1463.    CHOOSE command brings up the main menu, and the SET VAR commands
  1464.    extract the choices. Here are the incorrect SET commands:
  1465.  
  1466.         SET VAR pick11 = (SSUB(pick1,1))
  1467.         SET VAR pick12 = (SSUB(pick1,2))
  1468.  
  1469.    To conform to R:BASE syntax, the variable PICK1 should be dotted in
  1470.    both SSUB functions. Also, the commas are hard-coded; that is, even if
  1471.    you change your delimiter, Application EXPRESS still puts in commas
  1472.    instead of your current delimiter character. The application executes
  1473.    correctly even with the incorrect syntax as long as your current
  1474.    delimiter is a comma.
  1475.  
  1476.    WORKAROUND:  No workaround is necessary unless you change your
  1477.    delimiter, or you want the syntax to be technically correct. In that
  1478.    case, you can modify the .APP file written by Application EXPRESS and
  1479.    then use CODELOCK to create a new .APX file.
  1480.  
  1481.  
  1482.  
  1483.    Reports Help Screen
  1484.    """""""""""""""""""
  1485.    Reports brings up the wrong help screen when you press [F1] while
  1486.    R:BASE is displaying the list of tables for you to choose a table for
  1487.    a new report. The help screen that comes up is the correct one for
  1488.    choosing a table for the Copy option.
  1489.  
  1490.    WORKAROUND:  Choose a table for the report. This is the table or view
  1491.    that holds the information you want to report on.
  1492.  
  1493.  
  1494.  
  1495.    BETWEEN & dBASE Indexes
  1496.    """""""""""""""""""""""
  1497.    When you use the BETWEEN operator in R:BASE on an indexed column,
  1498.    R:BASE often uses the index to quickly find the rows you need. But
  1499.    dBASE indexes don't work the same way R:BASE indexes do, so the
  1500.    BETWEEN operator doesn't work correctly on dBASE columns indexed with
  1501.    a dBASE index file (.NDX file). The same thing happens when you use
  1502.    the > and < or the >= and <= operators instead of BETWEEN to specify
  1503.    the range. dBASE indexes have no concept of ranges. When you use the
  1504.    BETWEEN operator on a dBASE indexed column, R:BASE doesn't retrieve
  1505.    the correct data.
  1506.  
  1507.    WORKAROUND:  Use a sub-SELECT instead of the BETWEEN operator if a
  1508.    dBASE column is indexed. For example, if KEYID is the indexed dBASE
  1509.    column and you want to find all KEYIDs that fall in the range 400 to
  1510.    500, use this WHERE  clause with a sub-SELECT to find the values:
  1511.  
  1512.  
  1513.  
  1514.    MICRORIM ONLINE February 1991 -------------------------- Page 23 of 31
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.         WHERE keyid >= 400 AND keyid IN +
  1522.           (SELECT keyid FROM tblname WHERE keyid <= 500)
  1523.  
  1524.  
  1525.  
  1526.    Compatibility OFF in Multi-user
  1527.    """""""""""""""""""""""""""""""
  1528.    This problem applies to multi-user installations only. If your
  1529.    database is on a network drive (or you're running SHARE) with
  1530.    COMPATIBILITY set OFF and MULTI set ON, and you remove a column from a
  1531.    table, the SYSINFO table is destroyed. It doesn't matter if the table
  1532.    you modify has no rows in SYSINFO. R:BASE moves the SYSINFO table to
  1533.    the end of the table list and leaves a table with a name composed of
  1534.    high-order ASCII characters in the place where SYSINFO was originally.
  1535.  
  1536.    WORKAROUND:  Always set COMPATIBILITY ON or MULTI OFF before making
  1537.    any changes to the database structure. If you don't, you risk losing
  1538.    your database.
  1539.  
  1540.  
  1541.  
  1542.    Forms Containing EEPs
  1543.    """""""""""""""""""""
  1544.    If your R:BASE application is a procedure file (an .APX file) created
  1545.    by Application EXPRESS or by CODELOCK, you may experience a problem
  1546.    with forms that contain entry/exit procedures (EEPs). When you run the
  1547.    procedure file and use the form that contains the EEP, your computer
  1548.    may hang (stop responding), or you may get a memory manager error when
  1549.    you leave the form to return to the application.
  1550.  
  1551.    This is more likely to occur if the EEP is a block in a procedure file
  1552.    and it creates a playback file using code similar to the code shown on
  1553.    page 11-43 in the User's Manual. But it only occurs when the form is
  1554.    called by a procedure file. It happens because after R:BASE closes the
  1555.    file handle used by the EEP, R:BASE attempts to reopen the procedure
  1556.    file by calling for handle 0, which is invalid.
  1557.  
  1558.    WORKAROUND:  None, other than not using the form with the EEP or not
  1559.    calling it from a procedure file.
  1560.  
  1561.  
  1562.  
  1563.    Reordering Tables in a Form
  1564.    """""""""""""""""""""""""""
  1565.    While designing or modifying a form, if you choose "Change table
  1566.    order" to reorder a table in the form and then choose to remove that
  1567.    table, the computer will hang (stop responding) and SYSFORM (the table
  1568.    that holds all the forms for the database) may be ruined.
  1569.  
  1570.    WORKAROUND:  After changing table order in a form, save the form and
  1571.    then choose to modify it again before you remove any tables.
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.    MICRORIM ONLINE February 1991 -------------------------- Page 24 of 31
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.    Multi-user Form with Rules
  1587.    """"""""""""""""""""""""""
  1588.    In a multi-user environment, you may experience a display problem in a
  1589.    form region that has several tiers (rows) if you have a rule defined
  1590.    for the region table. This problem occurs when the database is on a
  1591.    network drive or when running the SHARE program with the database on a
  1592.    local drive.
  1593.  
  1594.    The problem occurs when you enter data into the region and that data
  1595.    violates the rule. When you try to add the row by moving to the next
  1596.    row in the region, by choosing "Add row" under Add/discard, or by
  1597.    choosing "Next section" under Go to, R:BASE gives you the rule
  1598.    violation as it should. When you press any key as directed, you get
  1599.    the rule violation again. Then if you press any key again, it looks
  1600.    like R:BASE has moved you to the next tier (row) in the region--the
  1601.    row below the one that violated the rule.
  1602.  
  1603.    But this is just how it looks. It isn't actually the case. R:BASE
  1604.    hasn't added a new row; it has redisplayed the original row in the
  1605.    wrong place in the region. Depending on how you have your region set
  1606.    up (number of lines, column data types, and so on) you may see no data
  1607.    displayed except in the field which had the rule violation, or you may
  1608.    see the row duplicated, or only some of the data. When you press
  1609.    [Enter] to move through the fields, the data from the original row
  1610.    displays field by field. If you now change the original data so it
  1611.    doesn't violate the rule, R:BASE will save the row correctly.
  1612.  
  1613.    WORKAROUND:  Although the inaccurate display can be disconcerting, it
  1614.    isn't hurting your database. Press [Enter] to get to the field that
  1615.    violated the rule, correct it, and then save the row by moving to the
  1616.    next row in the region, by choosing "Add row" under Add/discard, or by
  1617.    choosing "Next section" under Go to.
  1618.  
  1619.  
  1620.  
  1621.    Colors & Variable Forms
  1622.    """""""""""""""""""""""
  1623.    If you've previously changed the foreground and background colors on a
  1624.    variable form by choosing "Form settings" under Layout in Forms,
  1625.    you'll  get red-bar error messages when you attempt to modify that
  1626.    form. First R:BASE says "Press PgUp, PgDn, or Esc. Press any key to
  1627.    continue." When you press a key, R:BASE says "Warning-Invalid Entry
  1628.    for form use with ENTER command-defaulted to YES. Press any key to
  1629.    continue." Now if you press a key, R:BASE allows you to modify the
  1630.    form. When you use the variable form, only the field locations and
  1631.    lines 24 and 25 reflect the specified foreground and background colors
  1632.    even though the color settings are correct.
  1633.  
  1634.    WORKAROUND:  Rather than changing the colors inside the form, change
  1635.    the screen colors by using the SET COLOR command.
  1636.  
  1637.  
  1638.  
  1639.    Size of Variable Forms
  1640.    """"""""""""""""""""""
  1641.    Variable forms can only use a maximum of 21 lines for text or variable
  1642.    locations even though you are allowed to create a 22-line variable
  1643.  
  1644.  
  1645.  
  1646.    MICRORIM ONLINE February 1991 -------------------------- Page 25 of 31
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.    form. If you put text or locations on the 22nd line, R:BASE says "-
  1653.    ERROR- Variable forms must fit on a single page" when you use the DRAW
  1654.    command to draw the variable form on the screen.
  1655.  
  1656.    WORKAROUND:  Keep variable forms under 22 lines.
  1657.  
  1658.  
  1659.  
  1660.    Expressions & Common Columns
  1661.    """"""""""""""""""""""""""""
  1662.    When you have expressions on a common column in a form, the field
  1663.    associated with the expression may not continue to display a value you
  1664.    enter into it. Exact symptoms vary with complexity of the expressions.
  1665.    For example, look at this expression:
  1666.  
  1667.         text_comcol = (CTXT(integer_col))
  1668.  
  1669.    Here TEXT_COMCOL is a TEXT common column and INTEGER_COL is an INTEGER
  1670.    column that's located in the form. After you enter a value into
  1671.    INTEGER_COL in the form, the value disappears if TEXT_COMCOL is the
  1672.    first column in the structure of the first table in the form as shown
  1673.    by the LIST command.
  1674.  
  1675.    When the expression assigned to the common column depends on more than
  1676.    one column or on a series of expressions, all or some of the fields
  1677.    that are involved in the expression may be blanked out after you enter
  1678.    the value. If you change tables and change back the values will
  1679.    reappear.
  1680.  
  1681.    WORKAROUND:  Try reordering the columns in the table by using the
  1682.    PROJECT command, or add a computed column.
  1683.  
  1684.  
  1685.  
  1686.    REFRESH Setting in Multi-user
  1687.    """""""""""""""""""""""""""""
  1688.    If you're using R:BASE in a multi-user environment and the
  1689.    "Autorefresh interval" is set to something other than zero, you may
  1690.    see the screen redrawn twice when two users are viewing data under the
  1691.    Info/Views menu and both users are on the last row of the table. The
  1692.    first time the screen is redrawn the information displayed is not
  1693.    correct, but the second redraw clears the problem.
  1694.  
  1695.    WORKAROUND:  Choose "Autorefresh interval..." under Multi-user on the
  1696.    Settings menu and set it to zero to avoid the problem.
  1697.  
  1698.  
  1699.  
  1700.    Editing NOTE Columns
  1701.    """"""""""""""""""""
  1702.    You may experience a display problem if you edit a NOTE column by
  1703.    using EDIT or BROWSE and specifying an edit box that has 20 or more
  1704.    lines with any width. For example, look at this EDIT command:
  1705.  
  1706.         EDIT notecol=20=10 FROM tblname
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.    MICRORIM ONLINE February 1991 -------------------------- Page 26 of 31
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.    If you move to the last row that meets the WHERE clause and try and
  1719.    move to the next row even thought there isn't one, the display for the
  1720.    NOTE field will move to the top three lines of the screen and
  1721.    overwrite the menus. You may be able to move back up to existing rows
  1722.    by pressing [PgUp], but the menu stays overwritten. Sometimes, as you
  1723.    try to move forward and backward through the table, you might get this
  1724.    error: "-ERROR- Disk problems. Please check disk and files."
  1725.  
  1726.    If you edit another column in addition to the NOTE column, the large
  1727.    white bar indicating the end of the table may move up to the top of
  1728.  
  1729.    the screen right under menu; if you try to move back up the rows,
  1730.    sometimes R:BASE will return you to the R> prompt.
  1731.  
  1732.    WORKAROUND:  This is a display problem only. You can prevent it by
  1733.    choosing to display any given field in a maximum of 19 lines.
  1734.  
  1735.  
  1736.  
  1737.    Deleting Files
  1738.    """"""""""""""
  1739.    After you use Prompt by Example (PBE) once in an R:BASE session, PBE
  1740.    becomes the default menu system replacing MENU (the R:BASE Main Menu)
  1741.    as the default menu system. If you save your current settings to your
  1742.    RBASE.CFG file after using PBE, R:BASE stores the keyword PROMPT in
  1743.    the .CFG file, so the next time you start R:BASE, PBE will be the
  1744.    default menu system. When you delete a file from the R> prompt with
  1745.    PBE as the default menu system, R:BASE asks you to confirm the
  1746.    deletion. After you answer "Yes" or "No," the R> prompt and cursor are
  1747.    no longer located on the left side of the screen. Instead you'll find
  1748.    them in the lower right corner of the spot on the screen where the
  1749.    confirmation dialog box was located.
  1750.  
  1751.    WORKAROUND:  Keep MENU as your default menu system. When MENU is your
  1752.    default menu system, R:BASE just goes ahead and deletes the file
  1753.    without asking you for confirmation, so you won't run into this
  1754.    problem.
  1755.  
  1756.  
  1757.  
  1758.    UPDATE & Periods or Decimals
  1759.    """"""""""""""""""""""""""""
  1760.    You may run into a problem when using UPDATE to change a TEXT column
  1761.    to the result of an expression (concatenation) when that expression is
  1762.    longer than 18 characters and includes a period (decimal point)
  1763.    somewhere after the first 18 characters. Your computer may hang (stop
  1764.    responding) or you may get some kind of error from the operating
  1765.    system or from your memory manager.
  1766.  
  1767.    For example, using the CONCOMP database, this command produces the
  1768.    problem:
  1769.  
  1770.         UPDATE employee SET empcity = ('xxx' + 'xxxxxxxxxxxxxxxxx.')
  1771.  
  1772.    R:BASE is getting confused because of the long TEXT value and the
  1773.    decimal point.
  1774.  
  1775.  
  1776.  
  1777.  
  1778.    MICRORIM ONLINE February 1991 -------------------------- Page 27 of 31
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.    WORKAROUND:  Put a concatenated value that includes a decimal point or
  1785.    period into a variable. Then use the dotted variable in the UPDATE
  1786.    command:
  1787.  
  1788.         SET VAR v1 TEXT = ('xxx' + 'xxxxxxxxxxxxxxxxx.')
  1789.         UPDATE employee SET empcity = .v1
  1790.  
  1791.  
  1792.  
  1793.    Saving Views from the Menus
  1794.    """""""""""""""""""""""""""
  1795.    R:BASE may give you an error such as "Bad WHERE clause" or "Query
  1796.    expression error" when you save a view from the Info/Views menu. This
  1797.    problem may occur when you've modified the view by checking or
  1798.    unchecking columns so that first table in the view ends up with a
  1799.    number of column equal to or fewer than the number of columns checked
  1800.    in the second table in the view.
  1801.  
  1802.    WORKAROUND:  Alter the number of checks, and you you can usually save
  1803.    the view. Save the view in some form before exiting from the
  1804.    Info/Views menu.
  1805.  
  1806.  
  1807.  
  1808.    Help with Queries
  1809.    """""""""""""""""
  1810.    You can use the Query screen to build a query. The Query screen is
  1811.    brought up by choosing "Show Query screen" under Query on the
  1812.    Info/Views (Browse/Edit) menu or by entering QBE or QUERY at the R>
  1813.    prompt. When you add a condition to the query, R:BASE gives you a menu
  1814.    of operators. After you choose an operator, R:BASE gives you a dialog
  1815.    box if that operator requires a comparison value. All this works as it
  1816.    should. But if you choose IN or NOT IN as the operator you chose,
  1817.    R:BASE doesn't give help when you press [F1] from the dialog box, and
  1818.    if you choose BETWEEN, R:BASE gives you a help screen with this title:
  1819.    "Choose a comparison operator (2 of 2)." In both cases, R:BASE should
  1820.    tell you enter a comparison value.
  1821.  
  1822.    WORKAROUND:  Enter a comparison value instead of choosing help.
  1823.  
  1824.  
  1825.  
  1826.    View Created by Self-join SELECT
  1827.    """"""""""""""""""""""""""""""""
  1828.    A view created by a self-join SELECT (a SELECT command or clause that
  1829.    joins rows from the same table together) may fail when it reaches the
  1830.    first null value in a column if the same indexed column is used twice
  1831.    in the WHERE clause.
  1832.  
  1833.    Here's an example that uses the same indexed column (ID) twice--once
  1834.    in the view definition and once in a SELECT command that uses the
  1835.    view. This example view joins the table EMPLOYEE with itself. EMPLOYEE
  1836.    contains these columns: ID, NAME, and SPOUSEID. Here's the CREATE VIEW
  1837.    command:
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.    MICRORIM ONLINE February 1991 -------------------------- Page 28 of 31
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.         CREATE VIEW view1 (xid, xname, xsid) +
  1852.           AS SELECT t1.id, t1.name, t1.spouseid +
  1853.           FROM employee t1, employee t2 +
  1854.           WHERE t1.spouseid = t2.id
  1855.  
  1856.    The view lists employees who have a spouse who is also an employee.
  1857.    The view works fine except when ID is an indexed column and you issue
  1858.    a SELECT command that uses a BETWEEN condition in the WHERE clause
  1859.    based on the ID column, like this:
  1860.  
  1861.         SELECT * FROM view1 WHERE xid BETWEEN 100 AND 200
  1862.  
  1863.    This command lists employees up to the first row where it finds a null
  1864.    in the SPOUSEID column. R:BASE is trying to select from both T1 and T2
  1865.    (really the same table) using the same indexed column (ID). A view
  1866.    definition that contains a WHERE clause when used with another command
  1867.    that uses that view and also contains a WHERE clause has the same
  1868.    effect as one combined WHERE clause.
  1869.  
  1870.    WORKAROUND:  Drop the index from the ID column, or switch the first
  1871.    WHERE clause (the one on the view definition) so that the indexed
  1872.    column is to the left of the equals sign. Then R:BASE won't use keys
  1873.    to build the view. In other words, this WHERE clause won't work:
  1874.  
  1875.         ...WHERE non_index_col = index_col +
  1876.           AND index_col BETWEEN...
  1877.  
  1878.    But this variation does work:
  1879.  
  1880.         ...WHERE index_col = non_index_col +
  1881.         AND index_col BETWEEN...
  1882.  
  1883.  
  1884.  
  1885.    Sorting and Data Retrieval
  1886.    """"""""""""""""""""""""""
  1887.    Sometimes R:BASE collects the wrong data when it sorts data and one of
  1888.    the selected columns--usually the last column in the table--is fully
  1889.    contained within the last 10 bytes of the row length.
  1890.  
  1891.    This problem doesn't always happen, it depends on how much data you're
  1892.    retrieving, how the data is read into memory, and which columns you
  1893.    select.
  1894.  
  1895.    When the problem does occur, it may show up as a very large, erroneous
  1896.    value (in the trillions), or it may show up as an asterisk-filled
  1897.    field because the erroneous value is too large for the field location.
  1898.  
  1899.    The problem arises because of the way the R:BASE file buffer system
  1900.    retrieves data. On occasion, the file buffer system retrieves data
  1901.    without taking into consideration the 10-byte overhead per row.
  1902.  
  1903.    WORKAROUND:  Choose one of these options:
  1904.  
  1905.      o  Add a NOTE column to the table so R:BASE must figure out the
  1906.         length of each row. When there is no NOTE column, R:BASE assumes
  1907.  
  1908.  
  1909.  
  1910.    MICRORIM ONLINE February 1991 -------------------------- Page 29 of 31
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.         the length of the row based on information in database file 1.
  1917.      o  Using the PROJECT command, reorder the columns so that all the
  1918.         columns selected (located) are near the top of the list of
  1919.         columns in the table as shown by the LIST command.
  1920.      o  Use the ALTER TABLE command to add a dummy TEXT column at least
  1921.         10 bytes long to the end of the row.
  1922.  
  1923.  
  1924.  
  1925.    BACKUP and Multiple Disks
  1926.    """""""""""""""""""""""""
  1927.    If you execute the BACKUP DATA command for a specific table like this:
  1928.  
  1929.         BACKUP DATA FOR tblname
  1930.  
  1931.    and the backup spans more than one disk, the LOAD command that R:BASE
  1932.    writes on the second and subsequent disks is incorrect.
  1933.  
  1934.    R:BASE writes the name of the first table in the database (usually
  1935.    SYSCOMP or SYSINFO) for the tablename on the second disk instead of
  1936.    the correct table to be loaded. To restore the backup, you'll have to
  1937.    edit the backup files to put in the correct table name. If you use the
  1938.    BACKUP DATA FOR table USING... syntax the USING clause is ignored on
  1939.    the second and subsequent disks.
  1940.  
  1941.    WORKAROUND:  Use the BACKUP ALL command to back up databases that will
  1942.    span multiple disks.
  1943.  
  1944.  
  1945.  
  1946.    ANINT Function
  1947.    """"""""""""""
  1948.    ANINT doesn't round decimal numbers that are less than 0.5. The ANINT
  1949.    function as documented should round a REAL or DOUBLE number to the
  1950.    nearest INTEGER and then return a whole number with a REAL or DOUBLE
  1951.    data type. But instead of rounding to the nearest whole number (0 in
  1952.    this case), R:BASE returns the original number. For example, the
  1953.    following SET VAR correctly returns 1.
  1954.  
  1955.         SET VAR V1 = (ANINT(.5))
  1956.  
  1957.    But this next SET VAR returns .49 instead of 0.
  1958.  
  1959.         SET VAR V1 = (ANINT(.49))
  1960.  
  1961.    The NINT function, which rounds and returns an INTEGER data type works
  1962.    correctly.
  1963.  
  1964.    WORKAROUND:  Use the NINT function and then change the data type of
  1965.    the resulting variable to the data type you need.
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.    MICRORIM ONLINE February 1991 -------------------------- Page 30 of 31
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.    +----------------------------+
  1983.    |                            |
  1984.    |  DB Graphics verison 1.0   |
  1985.    |                            |
  1986.    +----------------------------+
  1987.  
  1988.    Data Sets & DOUBLEs
  1989.    """""""""""""""""""
  1990.    Using DB Graphics, you can't create a data set file that uses a DOUBLE
  1991.    data type. If you attempt it, DB Graphics gives the error "File load
  1992.    error, line n - Invalid column name" where "n" is the line number in
  1993.    the file when you try to load the data set file.
  1994.  
  1995.    WORKAROUND:  Change the data type to REAL.
  1996.  
  1997.  
  1998.  
  1999.    DOS Functions in DB Graphics
  2000.    """"""""""""""""""""""""""""
  2001.    The DOS functions in DB Graphics may show -1 for the amount of room
  2002.    left on your hard disk.
  2003.  
  2004.    WORKAROUND:  If you experience this problem, call Microrim Technical
  2005.    Support (1-206-649-9551) to get DSIZE.EXE, a program that will correct
  2006.    this. DSIZE is an .EXE program that creates DRVSIZE.EXE. After you use
  2007.    DRVSIZE.EXE on the GRAPH.EXE file, DB Graphics will no longer give you
  2008.    the erroneous -1.
  2009.  
  2010.  
  2011.  
  2012.  
  2013.  
  2014.  
  2015.  
  2016.  
  2017.  
  2018.  
  2019.  
  2020.  
  2021.  
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.    MICRORIM ONLINE February 1991 -------------------------- Page 31 of 31
  2043.  
  2044.  
  2045.  
  2046.  
  2047.